/*
 *  Copyright (C) void Team 2010 Pedro Batista
 * 
 *  http://code.google.com/p/capacitec
 * 
 *  This file is part of capacitec.
 * 
 *  capacitec is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  capacitec is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with capacitec.  If not, see <http://www.gnu.org/licenses/>.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author pedro
 */
@Entity
@Table(name = "subPrograma", uniqueConstraints = {
	@UniqueConstraint(columnNames = {"id"})})
@NamedQueries({
	@NamedQuery(name = "SubPrograma.findAll", query = "SELECT s FROM SubPrograma s"),
	@NamedQuery(name = "SubPrograma.findById", query = "SELECT s FROM SubPrograma s WHERE s.id = :id"),
	@NamedQuery(name = "SubPrograma.findByNome", query = "SELECT s FROM SubPrograma s WHERE s.nome = :nome"),
	@NamedQuery(name = "SubPrograma.findByNumeroDeVagas", query = "SELECT s FROM SubPrograma s WHERE s.numeroDeVagas = :numeroDeVagas"),
	@NamedQuery(name = "SubPrograma.findBySituacao", query = "SELECT s FROM SubPrograma s WHERE s.situacao = :situacao")})
public class SubPrograma implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Basic(optional = false)
        @Column(name = "id", nullable = false)
	private Integer id;
	@Basic(optional = false)
        @Column(name = "nome", nullable = false, length = 100)
	private String nome;
	@Basic(optional = false)
        @Lob
        @Column(name = "publicoAlvo", nullable = false, length = 65535)
	private String publicoAlvo;
	@Basic(optional = false)
        @Column(name = "numeroDeVagas", nullable = false)
	private int numeroDeVagas;
	@Lob
        @Column(name = "observacoes", length = 65535)
	private String observacoes;
	@Basic(optional = false)
        @Column(name = "situacao", nullable = false, length = 12)
	private String situacao;
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "subPrograma")
	private List<Curso> cursoList;
	@JoinColumn(name = "programa_id", referencedColumnName = "id", nullable = false)
        @ManyToOne(optional = false)
	private Programa programa;
	@JoinColumn(name = "coordenador_pessoa_id", referencedColumnName = "pessoa_id", nullable = false)
        @ManyToOne(optional = false)
	private Coordenador coordenador;
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "subPrograma")
	private List<AlunoSubPrograma> alunoSubProgramaList;

	public SubPrograma() {
	}

	public SubPrograma(Integer id) {
		this.id = id;
	}

	public SubPrograma(Integer id, String nome, String publicoAlvo, int numeroDeVagas, String situacao) {
		this.id = id;
		this.nome = nome;
		this.publicoAlvo = publicoAlvo;
		this.numeroDeVagas = numeroDeVagas;
		this.situacao = situacao;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getPublicoAlvo() {
		return publicoAlvo;
	}

	public void setPublicoAlvo(String publicoAlvo) {
		this.publicoAlvo = publicoAlvo;
	}

	public int getNumeroDeVagas() {
		return numeroDeVagas;
	}

	public void setNumeroDeVagas(int numeroDeVagas) {
		this.numeroDeVagas = numeroDeVagas;
	}

	public String getObservacoes() {
		return observacoes;
	}

	public void setObservacoes(String observacoes) {
		this.observacoes = observacoes;
	}

	public String getSituacao() {
		return situacao;
	}

	public void setSituacao(String situacao) {
		this.situacao = situacao;
	}

	public List<Curso> getCursoList() {
		return cursoList;
	}

	public void setCursoList(List<Curso> cursoList) {
		this.cursoList = cursoList;
	}

	public Programa getPrograma() {
		return programa;
	}

	public void setPrograma(Programa programa) {
		this.programa = programa;
	}

	public Coordenador getCoordenador() {
		return coordenador;
	}

	public void setCoordenador(Coordenador coordenador) {
		this.coordenador = coordenador;
	}

	public List<AlunoSubPrograma> getAlunoSubProgramaList() {
		return alunoSubProgramaList;
	}

	public void setAlunoSubProgramaList(List<AlunoSubPrograma> alunoSubProgramaList) {
		this.alunoSubProgramaList = alunoSubProgramaList;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof SubPrograma)) {
			return false;
		}
		SubPrograma other = (SubPrograma) object;
		if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "entidades.SubPrograma[id=" + id + "]";
	}

}
